<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 数组降维
    let arr=[[1,2,3],[4,[5,6]]]
    
    // 1. toString转成字符串
    function handleArr(arr) {  
      let strArr=arr.toString().split(',')
      strArr.forEach((item,i)=>{
        strArr[i]=Number(item)
      })
      return strArr
    }

    console.log(handleArr(arr));

    // 2. 原生提供的flat方法，Infinity 作为深度，展开任意深度的嵌套数组
    console.log(arr.flat(Infinity));

  </script>
</body>
</html>